package com.transaction.demo.test.thread;

public class MyThread extends  Thread {

    Object object1;
    public MyThread(Object object){
       object1=object;
    }

    @Override
    public void run(){
         for(int i=0;i<10;i++){
             System.out.println("i="+i);
             try {
                 object1.wait();
             }catch (Exception e){

             }
         }
    }

    public static void main(String[] args){
        Object object=new Object();
        MyThread myThread=new MyThread(object);
        myThread.start();
        MyThread myThread2=new MyThread(object);
        myThread2.start();
    }
}
